<?php

namespace App\Http\Controllers\Agency;

use App\Http\Controllers\Controller;
use App\Services\RoleService;
use Illuminate\Http\Request;
use hg\apidoc\annotation as Apidoc;
/**
 * 角色管理
 * @Apidoc\Group("behind")
 */
class RoleController extends Controller
{
    /**
     * @Apidoc\Title ("角色列表不带分页")
     * @Apidoc\Url("/agency/getRoleList")
     * @Apidoc\Method("POST")
     * @Apidoc\Header("Authorization", type="string",require=true, desc="Bearer + accessToken")
     * @Apidoc\Param("page",type="int",require=true,desc="页数")
     * @Apidoc\Param("pageSize",type="int",require=true,desc="条数")
     * @Apidoc\Param("role_name",type="string",require=false,desc="账号")
     * @Apidoc\Returned("id",type="string",desc="列表id")
     * @Apidoc\Returned("pid",type="string",desc="父级id；0没有父级")
     * @Apidoc\Returned("role_name",type="string",desc="角色名称")
     * @Apidoc\Returned("desc",type="string",desc="角色简介")
     * @Apidoc\Returned("menu_ids",type="string",desc="菜单")
     * @Apidoc\Returned("is_super",type="int",desc="是否超管Y是N否")
     * @Apidoc\Returned("created_at",type="int",desc="添加时间")
     * @Apidoc\Returned("parent_role_name",type="string",desc="父级角色名称")
     * @Apidoc\Returned("nums",type="string",desc="下属员工数量")
     *
     */
    public function getRoleList(RoleService $roleService , Request $request)
    {
        $params = $request->input();
        $params['aid'] = $this->getAid();
        $list = $roleService->getUserList($params);
        return $this->responseSuccess($list);
    }

    /**
     * @Apidoc\Title ("角色列表带分页")
     * @Apidoc\Url("/agency/roleList")
     * @Apidoc\Method("POST")
     * @Apidoc\Header("Authorization", type="string",require=true, desc="Bearer + accessToken")
     * @Apidoc\Param("page",type="int",require=true,desc="页数")
     * @Apidoc\Param("pageSize",type="int",require=true,desc="条数")
     * @Apidoc\Param("role_name",type="string",require=false,desc="账号")
     * @Apidoc\Returned("id",type="string",desc="列表id")
     * @Apidoc\Returned("pid",type="string",desc="父级id；0没有父级")
     * @Apidoc\Returned("role_name",type="string",desc="角色名称")
     * @Apidoc\Returned("desc",type="string",desc="角色简介")
     * @Apidoc\Returned("menu_ids",type="string",desc="菜单")
     * @Apidoc\Returned("is_super",type="int",desc="是否超管Y是N否")
     * @Apidoc\Returned("created_at",type="int",desc="添加时间")
     * @Apidoc\Returned("parent_role_name",type="string",desc="父级角色名称")
     * @Apidoc\Returned("nums",type="string",desc="下属员工数量")
     *
     */
    public function roleList(RoleService $roleService , Request $request)
    {
        $params = $request->input();
        $params['aid'] = $this->getAid();
        $list = $roleService->getList($params);
        return $this->responseSuccess( $list);
    }
}
